const TOKEN_KEY = "USER_TOKEN";
const USER_KEY = "USER_INFO"
export const getToken = ()=>{
    return window.sessionStorage.getItem(TOKEN_KEY) && atob(window.sessionStorage.getItem(TOKEN_KEY));
}

export const setToken = (tokenData)=>{
    window.sessionStorage.setItem(TOKEN_KEY,btoa(tokenData));
}

export const setUser = (userInfo)=>{
    window.sessionStorage.setItem(USER_KEY,JSON.stringify(userInfo));
}

export const getUser = ()=>{
    return window.sessionStorage.getItem(USER_KEY) && JSON.parse(window.sessionStorage.getItem(USER_KEY));
}

export const removeToken = ()=>{
    window.sessionStorage.removeItem(TOKEN_KEY);
}

export const removeUser = ()=>{
    window.sessionStorage.removeItem(USER_KEY)
}